package userInterface;

import java.awt.Color;

public class Rectangle extends DrawObject
{
	public Rectangle(Rectangle rect)
	{
		super(rect.getColor());
		super.setShape(Shape.RECTANGLE);
		_topLeft = rect.getTopLeft();
		_width = rect.getWidth();
		_height = rect.getHeight();
		_thickness = rect.getThickness();
	}
	
	public Rectangle(Point topLeft, int width, int height, int thickness, Color color)
	{
		super(color);
		super.setShape(Shape.RECTANGLE);
		_topLeft = new Point(topLeft.X, topLeft.Y);
		_width = width;
		_height = height;
		_thickness = thickness;
	}
	
	public int getThickness()
	{
		return _thickness;
	}
	
	public void setThickness(int thickness)
	{
		_thickness = thickness;
		for (DrawingModel m : _models)
			m.modelChanged();
	}
	
	public Point getTopLeft()
	{
		return _topLeft;
	}
	
	public void setTopLeft(Point topleft)
	{
		_topLeft = topleft;
		for (DrawingModel m : _models)
			m.modelChanged();
	}
	
	public int getWidth()
	{
		return _width;
	}
	
	public void setWidth(int width)
	{
	//	if (width < 5 && width > -5)
	//		return;
		
		_width = width;
		for (DrawingModel m : _models)
			m.modelChanged();
	}
	
	public int getHeight()
	{
		return _height;
	}
	
	public void setHeight(int height)
	{
	//	if (height < 5 && height > -5)
	//		return;
		
		_height = height;
		for (DrawingModel m : _models)
			m.modelChanged();
	}
	
	@Override
	public void move(int x, int y)
	{
		_topLeft = new Point(_topLeft.X + x, _topLeft.Y + y);
		for (DrawingModel m : _models)
			m.modelChanged();
	}

	private Point _topLeft;
	
	private int _width;
	
	private int _height;
	
	private int _thickness;
}
